<?php
include ('configuration.php'); 
	session_start();
	$var1= $_SESSION["registrado"];
	$var2= $_SESSION["administrador"];
	if ($var1 == null): {
		echo ("User not registered");
	} elseif ($var2 == 0): { 
			echo ("User without permissions");
	} else : {
        

	
//hago responsables a los miembros seleccionados
    $id_member=$_POST['select_responsible'];
    $id_pro=$_GET['id_pro'];  //bien
 
	
             //como solo muestro los iembros que tienen mail, se seguro que el responsable lo tendrá
    	    $q1="UPDATE participate SET is_responsible='1' 
    	        WHERE id_project_participate='$id_pro' and id_member_participate='$id_member'";
    	    mysql_query($q1) or die('Error, query failed');
    	    
    	   
            ?><script type="text/javascript">
                 alert("Responsibles added to project");
              </script>

<!doctype html>
<html xmlns:fb="http://www.facebook.com/2008/fbml">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<link href="css/bootstrap.css" rel="stylesheet" media="screen">
<link href="css/bootstrap-responsive.css" rel="stylesheet"	media="screen">

<title>My project manager</title>



</head>

<body>

	<script type="text/javascript"
		src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/bootstrap.js"></script>

	
	<div class="navbar navbar-inverse navbar-fixed-top">
		<div class="navbar-inner">
			<div class="container-fluid">
				<button type="button" class="btn btn-navbar" data-toggle="collapse"
					data-target=".nav-collapse">
					<span class="icon-bar"></span> <span class="icon-bar"></span> <span
						class="icon-bar"></span>
				</button>
				<a class="brand" href="http://localhost/bases--grupo10/homeAdmin.php?">My project manager</a>
				<div class="nav-collapse collapse">
					<p class="navbar-text pull-right">
					
						<a href="http://localhost/bases--grupo10/logout.php?" class="navbar-link">Log out</a>
					</p>
					<ul class="nav">
						<li class="active"><a href="http://localhost/bases--grupo10/homeAdmin.php?">Home</a></li>
						<li><a href="http://localhost/bases--grupo10/about.php?">About</a></li>
						<li><a href="http://localhost/bases--grupo10/contact.php?">Contact</a></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
    
    <div class="span12" style="position:absolute;top:50px;left:50px;">	
	    <h1 class="muted">Members and responsibles from project > </h1>
    </div>
    
 <div class="span12" style="position:absolute;top:150px;left:50px;">       					
    <div class="span5">
   		<div class="container-fluid" >
   		<table  class="table table-striped table-condensed" border="1" >
			  <thead>
		      <tr>
		          <th>Members</th>                                     
		      </tr>
		 	 </thead>   
			  <tbody>
   			<?php     
             $id_pro=$_GET['id_pro'];
             $q1 = mysql_query("SELECT id_member, name_member, surnames_member FROM project_member WHERE id_member IN (
                    SELECT id_member_participate FROM participate WHERE id_project_participate =  '$id_pro')") or die ("Query error");
             while($row=mysql_fetch_array($q1)){
                echo "<tr>";
                echo "<td>" . $row["name_member"] . " ".$row['surnames_member']. "</td>";
                echo "</tr>";
             }         
             ?>
   		    </tbody>
   		</table>    	
	    </div>
	</div>
	
    <div class="span5">
   		<div class="container-fluid" >
   		<table  class="table table-striped table-condensed" border="1" >
			  <thead>
		      <tr>
		          <th>Responsible</th>
		      </tr>
		 	 </thead>   
			  <tbody>
   			<?php     
             $id_pro=$_GET['id_pro'];
             $q1 = mysql_query("SELECT id_member, name_member, surnames_member FROM project_member WHERE id_member IN (
                SELECT id_member_participate FROM participate WHERE id_project_participate ='$id_pro' 
                    AND  `is_responsible` =  1)") or die ("Query error");
             while($row=mysql_fetch_array($q1)){
                echo "<tr>";
                echo "<td>" . $row["name_member"] . " ".$row['surnames_member']. "</td>";
                echo "</tr>";
             }         
             ?>
   		    </tbody>
   		 </table>   
		</div>
	</div>
</div>

    <a class="btn btn-primary" type="button" href="http://localhost/bases--grupo10/homeAdmin.php?" style="position:absolute;top:500px;left:1150px">Finish</a>  	
	

</body>
</html>


<?php  
            
}endif;?>